package com.tw.todolistservice.controller;
import com.tw.todolistservice.model.ToDo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;

@RestController
public class TodolistController {

  @GetMapping(value = "/heartbeat")
  public ResponseEntity<String> postTodo()
  {
    return ResponseEntity.ok().body("hello world!");
  }
  @GetMapping("/todoList")
  public List<ToDo> postTodo2() throws ParseException {
    List<ToDo> todoList = new ArrayList();
    ToDo thing1 = new ToDo("工作", "下午两点开会","2022-05-12");
    ToDo thing2 = new ToDo("健身", "下午六点举铁","2022-05-13");
    ToDo thing3 = new ToDo("生活", "早上十点订花","2022-05-14");
    todoList.add(thing1);
    todoList.add(thing2);
    todoList.add(thing3);
    return todoList;
  }
}
